package com.profgj.profgj;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.util.ClassUtils;
import org.springframework.util.ResourceUtils;
import org.springframework.web.client.RestTemplate;
import java.io.FileNotFoundException;
/**
 * springboot主启动类
 * @SpringBootApplication   自动装配加载一些主要配置
 * @MapperScan(basePackages = "com.profgj.profgj.dao")  扫描entity对象位置
 * @EnableScheduling       启用spring定时任务功能
 */
@EnableScheduling
@SpringBootApplication
@MapperScan(basePackages = "com.profgj.profgj.dao")
public class ProfgjApplication {

    public static void main(String[] args) throws FileNotFoundException {

        System.out.println("==:"+ ResourceUtils.getURL("classpath:").getPath());
        System.out.println("==:"+ ClassUtils.getDefaultClassLoader().getResource("").getPath());
        SpringApplication.run(ProfgjApplication.class, args);
    }

    /**
     * HTTP请求对象 纳入spring容器中 管理
     * @return
     */
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
